require('../css/home.less');
document.ready(function () {
    let BASE_URL="http://localhost:8099"
    // 获取父级节点
    let wrapper = document.querySelector('.swiper-wrapper')
    let user = JSON.parse(localStorage.getItem('user'));
    console.log(user);
    http.get(`/home/getBannerList?id=` + user, function (res) {
        console.log(res);
        if (res.code === 0) {
            let html = "";
            res.data.forEach(function(item) {
                html = `
                <div class="swiper-slide">
                <img src="${BASE_URL}${item.img}" alt="">
            </div>`
            })
            wrapper.innerHTML = html;
            var mySwiper = new Swiper('.swiper', {
                loop: true, // 循环模式选项
                // 如果需要分页器
                pagination: {
                    el: '.swiper-pagination',
                },
            })
        }

    })
   
})